import {  ElMessageBox } from 'element-plus'

class Dialog {
  constructor() {
    if (Dialog.instance) {
      console.log(Dialog.instance,'Dialog.instance');
      // return Dialog.instance;
      return undefined;
    }
    this.init();
    Dialog.instance = false;
  }

  init() {
    // 初始化对话框内容和样式
    ElMessageBox.confirm('登录状态已过期，您可以继续留在该页面，或者重新登录', '系统提示', {
        confirmButtonText: '重新登录',
        cancelButtonText: '取消',
        type: 'warning',
      }).then(() => {
        localStorage.removeItem('token')
        localStorage.removeItem('userInfo')
        localStorage.removeItem('permissions')
        localStorage.removeItem('routes')
        localStorage.removeItem('zhongziConfig')
        location.reload()
      })
  }

  show() {
    // 显示对话框
  }

  hide() {
    // 隐藏对话框
  }
}

// const instance = new Dialog();
export default Dialog;